package cn.biplam.back.bean.systemManage;

import java.io.Serializable;

import cn.biplam.common.bean.sqlengine.Sql;
import cn.biplam.common.bean.systemManage.Product;
import cn.biplam.common.client.OperatorResult;
import cn.biplam.common.wrapper.ErrorMessage;

/**
 *  产品管理访问类
 * @author XiaoRuxing Nov 6, 20092:23:30 PM
 * @version 1.0
 */
public class ProductImp extends Product implements Serializable{

	private static final long serialVersionUID = 2938245954653791916L;
	
	private String userId;
	private String model;
	
	/**
	 * 创建产品访问类
	 * @param userId 用户ID
	 * @param model  模块ID
	 */
	public ProductImp(String userId, String model){
		this.userId = model;
		this.model = model;
	}
	
	/**
	 * 
	 * @return 获取模型是否发布
	 * @throws ErrorMessage
	 */
	@Override
	public boolean modelIsDeploy() throws ErrorMessage {
		StringBuilder sb = new StringBuilder("select p_service from sys_product where p_name='");
		sb.append(model);
		sb.append('\'');
		this.setUserId(userId, null);
		OperatorResult rs = this.doingSelect(new Sql(sb.toString()));
		return rs.isNull()?false:rs.getBooleanValue("p_service");
	}
}
